<?php
require 'dbconnect.inc.php';
$result=mysqli_query($link,"select * from content") or die ($conn_error_msg);

while($row=mysqli_fetch_array($result)){
    $startpos=$row['spos'];
    $endpos=$row['epos'];
    $text="maintext";
    echo 'selectAndHighlightRange("maintext",'.$startpos.','.$endpos.');';
}
mysqli_close($link);
?>